package com.example.zhaohang.bingzhuangtu;

import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;

/**
 * Created by zhaohang on 2017/3/22.
 */

public class BaseActivity extends AppCompatActivity {

    private ProgressDialog mDialog;

    public void StartActivity(Class clazz, boolean isFinsh){
        startActivity(new Intent(this,clazz));
        if (isFinsh){
            finish();
        }

    }

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //初始化对话框
        mDialog = new ProgressDialog(this);

        //设置不能取消
        mDialog.setCancelable(false);


    }

    public void showDialog(String msg){
        //对话框显示信息
        mDialog.setMessage(msg);
        mDialog.show();

    }
    public void hidDialog(){
        //对话框隐藏
       // mDialog.hide();会造成内存泄漏
        mDialog.dismiss();
    }
}
